package pl.edu.pb.wi.cookbook.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import pl.edu.pb.wi.cookbook.form.SearchForm;

public class SearchInterceptor extends HandlerInterceptorAdapter {

    @Override
    public void postHandle(HttpServletRequest request,
            HttpServletResponse response, Object handler,
            ModelAndView modelAndView) throws Exception {
        if (modelAndView != null && modelAndView.getModel() != null)
            modelAndView.getModel().put("searchForm", new SearchForm());
    }
}
